﻿using System.Collections.Generic;
using System.Linq;
using abilities.parameters;
using abilities.targets;
using UnityEngine;
using UnityEngine.Serialization;

namespace abilities
{
    public class UnitObject:MonoBehaviour
    {
        public readonly ParameterCollection Parameter = new ParameterCollection();
        public AbilityManager abilityManager;
        public int Hp;
        public Vector3 position;
        public int articleId;
        public TargetUnitSide unitSide;

        public bool isDead()
        {
            return Hp <= 0;
        }

        public static implicit operator bool(UnitObject obj)
        {
            return obj != null;
        }

        public static List<UnitObject> UnitsInSight()
        {
            return FindObjectsOfType<UnitObject>().ToList();
        }
    }
}